@echo off
set str=Outer
echo %str%

CALL :SetValue str

echo %str%

EXIT /B %ERRORLEVEL%
:SetValue
SETLOCAL
set str=Inner
set "%~1=%str%"
echo %str%
ENDLOCAL
EXIT /B 0